package com.jumper.property.comparer.core.data;

import com.jumper.property.comparer.core.annotations.DiffKey;
import com.jumper.property.comparer.core.annotations.convert.BooleanFormat;
import com.jumper.property.comparer.core.annotations.convert.DateFormat;
import com.jumper.property.comparer.core.annotations.convert.LocalDateFormat;
import com.jumper.property.comparer.core.annotations.convert.LocalDateTimeFormat;
import com.jumper.property.comparer.core.constant.DiffConstant;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * 商品订单
 */
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class GoodsOrder {

    @DiffKey(name = "订单编号")
    private String orderNo;

    @BooleanFormat
    @DiffKey(name = "自动配送")
    private boolean autoDelivery;

    @LocalDateTimeFormat(pattern = "yyyy-MM-dd")
    @DiffKey(name = "有效开始时间", type = DiffConstant.COMBINATION_PROPERTY, combinationName = "订单有效时间")
    private LocalDateTime startTime;

    @LocalDateTimeFormat(pattern = "yyyy-MM-dd")
    @DiffKey(name = "有效结束时间", type = DiffConstant.COMBINATION_PROPERTY, combinationName = "订单有效时间")
    private LocalDateTime endTime;

    @DiffKey(name = "商品列表", type = DiffConstant.ARRAY_PROPERTY, subCls = GoodsItem.class, whenArrayFullProperties = false)
    private List<GoodsItem> items;

    @DiffKey(name = "收货地址", type = DiffConstant.OBJECT_PROPERTY)
    private OrderAddress address;

    @LocalDateFormat(pattern = "yyyy-MM-dd")
    @DiffKey(name = "下单日期")
    private LocalDate orderDate;

    @DateFormat(pattern = "yyyy-MM-dd HH")
    @DiffKey(name = "支付时间")
    private Date paymentTime;
}
